import java.lang.annotation.*;

/**
 * @author 35326
 * 2021/3/18 15:23
 * 自定义注解
 */
//1 注解声明为@interface

@Inherited
@Repeatable(Annotations.class)
@Retention(RetentionPolicy.CLASS)
public @interface AnnotationTest {

	String value() default "123";

}


@Retention(RetentionPolicy.RUNTIME)
@Inherited
@interface Annotations{
	AnnotationTest[] value();
}

@AnnotationTest("hi")
@AnnotationTest
class Person{
	@AnnotationTest(value="1")
	int a;
	String b;

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}

		Person person = (Person) o;

		if (a != person.a) {
			return false;
		}
		return b != null ? b.equals(person.b) : person.b == null;
	}

	@Override
	public int hashCode() {
		int result = a;
		result = 31 * result + (b != null ? b.hashCode() : 0);
		return result;
	}
}
